### Configuration.  ####################################################
CC                     = gcc
# Default C compiler options
CFLAGS                 = 
# C source files for the server. 
SOURCES                = telescope61.c common.c rs232.c semaphore.c main.c
# Corresponding object files.
OBJECTS                = $(SOURCES:.c=.o)
# Target
TARGET		       = telescope61
### Rules.  ############################################################
# Phony targets don’t correspond to files that are built; they’re names
# for conceptual build targets.
.PHONY:		all clean

# Default target: build everything.
all:		telescope61 

# Clean up build products.
clean:
	rm -f $(OBJECTS) $(TARGET) 

# The main server program.  Link with -Wl,-export-dyanamic so
# dynamically loaded modules can bind symbols in the program.  Link in
# libdl, which contains calls for dynamic loading.
$(TARGET):		$(OBJECTS)
	$(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) -lm

# All object files in the server depend on server.h.  But use the
# default rule for building object files from source files.
$(OBJECTS): \
%.o:	%.c 
	$(CC) $(CFLAGS) -c $< 

